I would like to know if there is possible to show differences between two texts in a colourful manner in a text attribute. I used the diff function with the {//cf1} murkup and with RichText but it still appears black and white. |
Re: Text Colors I import the attached document to highlight text in different colours and using one of the Kitchen scripts (Kitchen > Columns > Display RTF attributes in Column...) it shows the following code: {\rtf1\ansi\ansicpgl252\deff0\deflang1033{\fonttbl{\f0\froman\fprq2\\fcharset0 Times New Roman;}{\f1\fnil\fcharset0 Tahoma;}}{\colortbl ;\red255\green255\blue0;}\viewkind4\ucl\pard\highlight1\lang2057\f0\fs24 Colour Highlights - Yellow\highlight0\lang1033\f1\fs1660\par} It's not what you're after, but some of the code might provide some clues... Simon Haydn BSc (Hons) Requirements Controller Marshall Aerospace (UK) Attachments attachment_14236182_Colour_Highlights.doc |
Re: Text Colors 1.) To get color text or color highlighting in a Layout DXL column or in a richText box in a dialog box, you need to understand and use some basic Rich Text formatting tags. 2.) At the start of every Rich Text block of text, you will need to include a "color table", defined by the "{\\colortbl; ... }" tag. 3.) Then, you will use the "color font" tags, such as "\\cf1" or "\\cf2" to color the text. Or, you will use the "highlight" tags, such as "\\highlight1" or "\\highlight2", to use a color highlight. The numbers refer to the colors defined in the "color table". You use "\\cf0" and "\\highlight0" to turn off colors. 4.) In a Layout DXL column, you must use the "displayRich(string)" command, to get the colors to show in the module window. 5.) In a richText box in a dialog box, you must use the "useRTFColour(DBE,true)" command, to get the colors to show in the richText box. Here is a sample "color table" definition: string xColorTable = "{\\colortbl ;\\red255\\green0\\blue0;\\red0\\green255\\blue0;\\red0\\green0\\blue255;\\red255\\green255\\blue0;\\red255\\green0\\blue255;\\red0\\green255\\blue255;\\red255\\green255\\blue255;\\red0\\green0\\blue0;}" Here is the same color table, broken out with some // comments to explain it: string xColorTable = "{\\colortbl ;" xColorTable = xColorTable "\\red255\\green0\\blue0;" // red \\cf1 \\highlight1 xColorTable = xColorTable "\\red0\\green255\\blue0;" // green \\cf2 \\highlight2 xColorTable = xColorTable "\\red0\\green0\\blue255;" // blue \\cf3 \\highlight3 xColorTable = xColorTable "\\red255\\green255\\blue0;" // yellow \\cf4 \\highlight4 xColorTable = xColorTable "\\red255\\green0\\blue255;" // purple \\cf5 \\highlight5 xColorTable = xColorTable "\\red0\\green255\\blue255;" // light blue \\cf6 \\highlight6 xColorTable = xColorTable "\\red255\\green255\\blue255;" // white \\cf7 \\highlight7 xColorTable = xColorTable "\\red0\\green0\\blue0;" // black \\cf8 \\highlight8 xColorTable = xColorTable "}" For colors in a Layout DXL column, you could do something like (using the xColorTable from above): displayRich xColorTable "{\\cf1 This is red text. \\cf0\\highlight4 This is yellow highlight \\highlight0 }" For colors in a richText DBE in a dialog box, you could do something like (using the xColorTable from above): string xSample = xColorTable "{\\cf1 This is red text. \\cf0\\highlight4 This is yellow highlight \\highlight0 }" DB xDB = centered("Colors in a richText DBE") DBE xRichText = richText(xDB,"richText DBE:","empty",360,250,false) realize(xDB) useRTFColour(xRichText,true) set(xRichText,xSample) show(xDB) I've attached a screen shot of the richText dialog box example. With this method, you can get 16.7 million possible colors (256^3). You will have to work your own code to get the text difference comparison. Attachments attachment_14236234_RichTextColor.jpg |
Re: Text Colors SystemAdmin - Wed Apr 01 10:05:38 EDT 2009 You can use these standard values for the markup. removeMarkup = "\cf1\strike" insertMarkup = "\cf2\ul" AAI Services, Textron dpechacek@sc-aaicorp.com David.Pechacek@gmail.com |
Re: Text Colors dpechacek - Wed Apr 01 10:54:11 EDT 2009 You're using displayRich(stringOf(resultBuffer)) right? AAI Services, Textron dpechacek@sc-aaicorp.com David.Pechacek@gmail.com |
Re: Text Colors Yuuuuuuuck, but it works. I can safely say this, when combined with my normal export-to-word fiasco, is by far the hardest to grasp when plowing through my massive library of functions. I don't even get it, and if I have to dive into it again it will take me a week just to grasp it, in spite of all the 'comments' I've tried to insert to explain things to myself. >Louie |
Re: Text Colors dpechacek - Wed Apr 01 10:54:11 EDT 2009 What I want is to display the differences in a TEXT attribute in a column from a module. I will show my exemple to make an idea of what I am trying: Buffer buff1 = create() Buffer buff2 = create() bool ok; string afis for obj in (current Module) do { string obo = obj."YesNo" // Yes or No buff1 = obj."Object Text" buff2 = obj."TestText" if (obj."Object Heading" "" != "") then { buff1 = obj."Object Heading" } if (obj."Object Text" "" != "") then { buff1 = obj."Object Text" } Buffer resBuf = create(); string result = diff(resBuf, buff1, buff2, "\\cf1\\strike ","\\cf2\\ul " ); obj."TestRichText" = richText resBuf delete resBuf } delete(buff1) delete(buff2) ---- string result = diff(resBuf, buff1, buff2, "\\cf1\\strike ","\\cf2\\ul " ); In this line eventhough I use the tags "\\cf1", "\\cf2" the differences still apear monochrome. In this way I would like to make the text appear color if it is possible without using Layout DXL. I attached you also a jpg file to understand better what I want to obtain. Thank you ! Attachments attachment_14236670_color.JPG |
Re: Text Colors Manilla - Thu Apr 02 05:57:05 EDT 2009 Buffer buff1 = create() Buffer buff2 = create() bool ok; string afis for obj in (current Module) do { string obo = obj."YesNo" // Yes or No buff1 = obj."Object Text" buff2 = obj."TestText" if (obj."Object Heading" "" != "") then { buff1 = obj."Object Heading" } if (obj."Object Text" "" != "") then { buff1 = obj."Object Text" } Buffer resBuf = create(); string result = diff(resBuf, buff1, buff2, "\\cf1\\strike ","\\cf2\\ul " ); obj."TestRichText" = richText resBuf delete resBuf } delete(buff1) delete(buff2) ---- string result = diff(resBuf, buff1, buff2, "\\cf1\\strike ","\\cf2\\ul " ); In this line eventhough I use the tags "\\cf1", "\\cf2" the differences still apear monochrome. In this way I would like to make the text appear color if it is possible without using Layout DXL. I attached you also a jpg file to understand better what I want to obtain. Thank you ! |
Re: Text Colors djakad - Thu Apr 02 10:10:47 EDT 2009 diff(resBuf, oldBuf, newBuf, true) *displayRichWithColor*(stringOf(resBuf)) |
Re: Text Colors SystemAdmin - Fri Apr 03 05:32:00 EDT 2009 diff(resBuf, oldBuf, newBuf, true) displayRichWithColor (stringOf(resBuf)) |
Re: Text Colors SystemAdmin - Fri Apr 03 05:33:42 EDT 2009 I can't change the font of the text in the column...I've tried the methods you told me but none seems to work |
Re: Text Colors has anyone been able to get this to work? I tried to include the color table, but doesn't work Cheers Harald |
Re: Text Colors DEHKB - Thu Apr 16 09:16:04 EDT 2009 I had a similar problem: text remained black on white background although colortable was defined (pasted the one from djakad). Indeed, displayRich does not work, but the undocumented "displayRichWithColor" does the job: displayRichWithColor xColorTable "{\\cf1 This is red text. \\cf0\\highlight4 This is yellow highlight \\highlight0 }" -- Nick |
Re: Text Colors dpechacek - Wed Apr 01 11:03:21 EDT 2009 Seems that the post is talking about a rich text box control that enables you to change the text color freely. |
Re: Text Colors djakad - Wed Apr 01 10:53:32 EDT 2009 Wow, awesome post, thanks for the info. Exactly the kind of detail I was looking for! |